package com.isunland.managesystem.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import java.util.Date;

/**
 * 对象功能: 查询日期类.
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2016/12/21 18:54
 */

public class QueryDateActivity extends SingleFragmentActivity {
  private Date mStartDate;
  private Date mEndDate;

  @Override public void onCreate(Bundle arg0) {
    mStartDate = (Date) getIntent().getSerializableExtra(QueryDateFragment.EXTRA_START_DATE);
    mEndDate = (Date) getIntent().getSerializableExtra(QueryDateFragment.EXTRA_END_DATE);
    super.onCreate(arg0);
  }

  @Override protected Fragment createFragment() {
    return QueryDateFragment.newInstance(mStartDate, mEndDate);
  }

  public static void startActivityForResult(android.support.v4.app.Fragment fragm, Date startDate,
      Date endDate, int requestCode) {
    if (fragm == null || fragm.getActivity() == null) return;
    Intent intent = new Intent(fragm.getActivity(), QueryDateActivity.class);
    intent.putExtra(QueryDateFragment.EXTRA_START_DATE, startDate);
    intent.putExtra(QueryDateFragment.EXTRA_END_DATE, endDate);
    fragm.startActivityForResult(intent, requestCode);
  }
}
